<%@ page import="cn.gudian.cms.Admin.AuthSession; cn.gudian.cms.Comment.Comment" %>
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
  <meta name="layout" content="main"/>
  <title><g:message code="comment.edit" default="Edit Comment"/></title>
</head>
<body>
<div class="nav">
  <span class="menuButton"><a class="home" href="${createLinkTo(dir: '')}"><g:message code="home" default="Home"/></a></span>
  <span class="menuButton"><a href="/comment/list?mode=${commentInstance?.mode}&modeID=${commentInstance?.modeID}"><g:message code="comment.list" default="Comment List"/></a></span>
</div>
<div class="body">
  <h1><g:message code="comment.edit" default="Edit Comment"/></h1>
  <g:if test="${flash.message}">
    <div class="message"><g:message code="${flash.message}" args="${flash.args}" default="${flash.defaultMessage}"/></div>
  </g:if>
  <g:hasErrors bean="${commentInstance}">
    <div class="errors">
      <g:renderErrors bean="${commentInstance}" as="list"/>
    </div>
  </g:hasErrors>
  <g:form method="post">
    <g:hiddenField name="id" value="${commentInstance?.id}"/>
    <g:hiddenField name="version" value="${commentInstance?.version}"/>

    <g:hiddenField name="mode" value="${commentInstance?.mode}"/>
    <g:hiddenField name="modeID" value="${commentInstance?.modeID}"/>
    <g:hiddenField name="name" value="${commentInstance?.name}"/>
    <g:hiddenField name="contact" value="${commentInstance?.contact}"/>
    <g:hiddenField name="content" value="${commentInstance?.content}"/>
    <g:hiddenField name="subTime" value="${commentInstance?.subTime}"/>
    <g:hiddenField name="ip" value="${commentInstance?.ip}"/>
    <div class="dialog">
      <table>
        <tbody>
        <tr class="prop">
          <td valign="top" class="name">
            <label for="content"><g:message code="comment.content" default="Content"/>:</label>
          </td>
          <td valign="top" class="value ${hasErrors(bean: commentInstance, field: 'content', 'errors')}">
            ${commentInstance?.content}

          </td>
        </tr>
        <tr class="prop">
          <td valign="top" class="name">
            <label for="audit"><g:message code="comment.audit" default="Audit"/>:</label>
          </td>
          <td valign="top" class="value ${hasErrors(bean: commentInstance, field: 'audit', 'errors')}">
            <g:checkBox name="audit" value="${commentInstance?.audit}"/>

          </td>
        </tr>

        <tr class="prop">
          <td valign="top" class="name">
            <label for="reName"><g:message code="comment.reName" default="Re Name"/>:</label>
          </td>
          <td valign="top" class="value ${hasErrors(bean: commentInstance, field: 'reName', 'errors')}">
           <g:textField name="reName" value="${commentInstance.reName==''?AuthSession.getUser(session).getUserName():commentInstance.reName}"/>

          </td>
        </tr>

        <tr class="prop">
          <td valign="top" class="name">
            <label for="reContet"><g:message code="comment.reContet" default="Re Contet"/>:</label>
          </td>
          <td valign="top" class="value ${hasErrors(bean: commentInstance, field: 'reContet', 'errors')}">
            <g:textArea name="reContet" value="${fieldValue(bean: commentInstance, field: 'reContet')}"/>

          </td>
        </tr>

        <tr class="prop">
          <td valign="top" class="name">
            <label for="reTime"><g:message code="comment.reTime" default="Re Time"/>:</label>
          </td>
          <td valign="top" class="value ${hasErrors(bean: commentInstance, field: 'reTime', 'errors')}">
            <gd:datePicker name="reTime" value="${commentInstance?.reTime}"/>

          </td>
        </tr>

        </tbody>
      </table>
    </div>
    <div class="buttons">
      <span class="button"><g:actionSubmit class="save" action="update" value="${message(code: 'update', 'default': 'Update')}"/></span>
      <span class="button"><g:actionSubmit class="delete" action="delete" value="${message(code: 'delete', 'default': 'Delete')}" onclick="return confirm('${message(code: 'delete.confirm', 'default': 'Are you sure?')}');"/></span>
    </div>
  </g:form>
</div>
</body>
</html>
